#include "useofconst.h"
#include <iostream>
using namespace std;

#define LENGTH 10
#define WIDTH 5
#define NEWLINE '\n'

const int A = 10;
const int B  = 5;
const int C = 100;
const int D = 25;

UseOfConst::UseOfConst()
{

}

void UseOfConst::show(){
    cout << "====================UseOfConst show===========================" << endl;

    // 1、常量的定义和使用，常量定义一般用全大写
    {
        cout << "常量LENGTH: " << LENGTH << endl;
        cout << "常量WIDTH: " << WIDTH << endl;
        cout << "常量NEWLINE: " << NEWLINE << endl;

        // LENGTH = 20; // 常量不能被修改，会报错
    }

    // 2、常量可以用于计算
    {
        int i = A + B;
        cout << "i = " << i << endl;

        cout << "C * D = " << C*D << endl;
    }
}
